class PracticeController < ApplicationController

  def index
	@upcoming_practice = Practice.upcoming_practice
	@past_practice = Practice.past_practice
  end

  def new
	@practice = Practice.new
  end

  def show
	@practice = Practice.find(params[:id])
  end

  def create
	@practice = Practice.new(params[:practice])
	if @practice.save
	  flash[:notice] = 'Practice Successfully Scheduled'
	  redirect_to :action => "index"
	else
	  render :action => "new"
	end
  end

  def destroy
	@practice = Practice.find(params[:id])
 	@practice.destroy

 	flash[:notice] = 'Practice successfully cancelled'
 	redirect_to :action => "index"
  end

  def update
	@practice = Practice.find(params[:id])

	if @practice.update_attributes(params[:practice])
	  flash[:notice] = 'Practice successfully updated.'
	  redirect_to :action => "show", :id => params[:id]
	else
	  render :action => "edit"
	end
  end

def edit
	@practice = Practice.find(params[:id])
  end
end

